package com.analyse.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.analyse.common.annotation.Log;
import com.analyse.common.core.controller.BaseController;
import com.analyse.common.core.domain.AjaxResult;
import com.analyse.common.enums.BusinessType;
import com.analyse.system.domain.Weibv3;
import com.analyse.system.service.IWeibv3Service;
import com.analyse.common.utils.poi.ExcelUtil;
import com.analyse.common.core.page.TableDataInfo;

/**
 * 热点分析Controller
 * 
 * @author analyse
 * @date 2023-05-09
 */
@RestController
@RequestMapping("/system/weibv3")
public class Weibv3Controller extends BaseController
{
    @Autowired
    private IWeibv3Service weibv3Service;

    /**
     * 查询热点分析列表
     */
    @PreAuthorize("@ss.hasPermi('system:weibv3:list')")
    @GetMapping("/list")
    public TableDataInfo list(Weibv3 weibv3)
    {
        startPage();
        List<Weibv3> list = weibv3Service.selectWeibv3List(weibv3);
        return getDataTable(list);
    }


    @GetMapping("/list2")

    public TableDataInfo list2(Weibv3 weibv3)
    {
        startPage();
        List<Weibv3> list = weibv3Service.selectWeibv3ListByTime(weibv3);
        return getDataTable(list);
    }


    /**
     * 导出热点分析列表
     */
    @PreAuthorize("@ss.hasPermi('system:weibv3:export')")
    @Log(title = "热点分析", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Weibv3 weibv3)
    {
        List<Weibv3> list = weibv3Service.selectWeibv3List(weibv3);
        ExcelUtil<Weibv3> util = new ExcelUtil<Weibv3>(Weibv3.class);
        util.exportExcel(response, list, "热点分析数据");
    }

    /**
     * 获取热点分析详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:weibv3:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(weibv3Service.selectWeibv3ById(id));
    }

    /**
     * 新增热点分析
     */
    @PreAuthorize("@ss.hasPermi('system:weibv3:add')")
    @Log(title = "热点分析", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Weibv3 weibv3)
    {
        return toAjax(weibv3Service.insertWeibv3(weibv3));
    }

    /**
     * 修改热点分析
     */
    @PreAuthorize("@ss.hasPermi('system:weibv3:edit')")
    @Log(title = "热点分析", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Weibv3 weibv3)
    {
        return toAjax(weibv3Service.updateWeibv3(weibv3));
    }

    /**
     * 删除热点分析
     */
    @PreAuthorize("@ss.hasPermi('system:weibv3:remove')")
    @Log(title = "热点分析", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(weibv3Service.deleteWeibv3ByIds(ids));
    }
}
